<% int validaSession = 2; %>
<%@ include file="Connections/session.jsp" %>

<%
String parId_almac = request.getParameter("id_almac");
%>
<html>
<head>
<title>CIMA v2 - Nueva Capacidad Tipo de Grano</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="miestilo.css" type="text/css">
<SCRIPT LANGUAGE="JavaScript" SRC="js/AnchorPosition.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript" SRC="js/PopupWindow.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript" SRC="js/date.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript" SRC="js/CalendarPopup.js"></SCRIPT>
<script>
var cal1 = new CalendarPopup();
var win1 = null;
//---------
	function tipoGranoCat() {
		win1 = window.open('tipoGrano_catalogo.jsp?campo1=tipoGrano&campo2=tipoGCod&campo3=tipoGDesc','TipoGrano_C','top=230,left=400,width=280,height=300');
	}
//-------
	function cierraVentanas() {
		obj1 = eval("win1");
		if (obj1 && !obj1.closed) {
			obj1.close();
		}
	}
//---------
	function enviaSubmit() {
		if (valida()) {
			document.form1.submit();
		}
	}
//--------
function noEsNum(num,opc){
	var checkOK = "";
	if (opc==1) {
		checkOK = "1234567890.";
	} else {
		checkOK = "1234567890";
	}
	var checkStr =num; // quantity.value;
	var allValid = true;
	for(i=0;i<checkStr.length;i++){
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkOK.length;  j++){
		      if (ch == checkOK.charAt(j))
	      	  break;
		}
		if (j == checkOK.length){
		     allValid = false;
		    	break;
		}
	}
	if(!allValid){
		return false;
	 }else{
		if (isNaN(num)){ //quantity.value)){
			return false;
	
		}else{
			return true;
		}
	} // fin if (!allValid)

}
//----------
function valida() {
	var Doc = document.form1;
	missinginfo = "";
	if (Doc.tipoGCod.value == "")     missinginfo += "\n     - Tipo de Grano";
	if (Doc.capacidad.value == "")     missinginfo += "\n     - Capacidad";
		else if (!noEsNum(Doc.capacidad.value,1)) missinginfo += "\n     - Dato no valido\n          en Capacidad";
		
	if (missinginfo != "") {
		missinginfo = "Favor de llenar los siguientes campos:\n_____________________________\n" + missinginfo +
					  "\n_____________________________\n";
		alert(missinginfo);
		return false;
	}else{
		return true;
	}
	//window.close()	
}
//-------------
function calendario1() {
	cal1.select(document.form1.fecha_llenado,'imgFL','dd/MM/yyyy');
	//return false;
}
//---------------
function calendario2() {
	cal1.select(document.form1.fecha_vaciado,'imgFV','dd/MM/yyyy');
	//return false;
}
//---------------
//funcion que convierte el valor del campo a mayusculas
function mayusculas(campo) {
	campo.value = campo.value.toUpperCase();
}
//---------------
</script>
</head>

<body bgcolor="#FFFFFF" text="#000000" background="images/fondo.jpg" leftmargin="0" topmargin="0" onUnload="cierraVentanas()">
<br>
<center>
  <form name="form1" method="post" action="bodega_captg_querys.jsp">
    <table width="250" border="0" cellspacing="0" cellpadding="0">
      <tr> 
        <td colspan="3" align="center" class="titulos">Nueva Capacidad por Tipo 
          de Grano</td>
      </tr>
      <tr> 
        <td width="100" class="etiqueta" align="right">&#149; Tipo de Grano</td>
        <td width="7">&nbsp;</td>
        <td><input type="text" name="tipoGrano" class="textfields" onFocus="blur()" size="20" readonly tabindex="-1"><input type="hidden" name="tipoGCod">
          <a href="javascript:tipoGranoCat()"><img src="images/buscar.gif" class="cursor" border="0" width="15" height="15"></a>
		</td>
      </tr>
      <tr> 
        <td class="etiqueta" align="right">Descripcion TG</td>
        <td>&nbsp;</td>
        <td>
          <input type="text" name="tipoGDesc" class="textfields" size="20" readonly onFocus="blur()" tabindex="-1">
        </td>
      </tr>
      <tr> 
        <td class="etiqueta" align="right">Ubicaci&oacute;n</td>
        <td>&nbsp;</td>
        <td>
          <input type="text" name="ubicacion" class="textfields" size="20" onKeyUp="mayusculas(this)" onKeyDown="mayusculas(this)" maxlength="5">
        </td>
      </tr>
      <tr> 
        <td class="etiqueta" align="right">&#149; Capacidad</td>
        <td>&nbsp;</td>
        <td>
          <input type="text" name="capacidad" class="textfields" size="18" maxlength="10">
          ton </td>
      </tr>
      <tr> 
        <td class="etiqueta" align="right">F. Llenado</td>
        <td>&nbsp;</td>
        <td>
          <input type="text" name="fecha_llenado" class="textfields" size="18" readonly onFocus="blur()" tabindex="-1">
          <a href="javascript:calendario1()"><img src="images/calendar2.gif" class="cursor" name="imgFL" border="0" width="18" height="18"></a>
		</td>
      </tr>
      <tr> 
        <td class="etiqueta" align="right">F. Vaciado</td>
        <td>&nbsp;</td>
        <td>
          <input type="text" name="fecha_vaciado" class="textfields" size="18" readonly onFocus="blur()" tabindex="-1">
          <a href="javascript:calendario2()"><img src="images/calendar2.gif" class="cursor" name="imgFV" border="0" width="18" height="18"></a>
        </td>
      </tr>
     <tr> 
        <td align="right" class="etiqueta">Ubicaci&oacute;n - 921.loca</td>
        <td>&nbsp;</td>
        <td> 
          <input type="text" name="inf_ubicacion" class="textfields" size="20" maxlength="8">
        </td>
      </tr>
      <tr> 
        <td align="right">&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr align="right"> 
        <td colspan="3" class="nota">&#149; Datos Requetridos</td>
      </tr>
    </table>
<br>
<table width="200" border="0" cellspacing="0" cellpadding="0">
  <tr>
        <td align="center">
          <input type="hidden" name="modalidad" value="nuevo">
          <input type="hidden" name="id_almac" value="<%=parId_almac%>">
          <a href="javascript:enviaSubmit()"><img src="images/bGuardar.gif" width="83" height="18" border="0"></a>&nbsp; 
          <a href="javascript:window.close()"><img src="images/bCerrar.gif" width="82" height="18" border="0"></a></td>
  </tr>
</table>
</form>
</center>
</body>
<HEAD>
<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
</HEAD>
</html>
